<template>
  <MyVanskeleton :loading="skeletonLoading">
    <template v-slot:my-content>
      <div class="company-style">
        <!-- 导航栏 start -->
        <van-nav-bar title="获取简历" left-arrow fixed @click-left="onLeftClick" />
        <!-- 导航栏 end -->

        <!-- 内容 -->
        <div class="content-top">
					<MyEmpty v-if="list.length == 0 && listLoading==false"/>
          <van-list v-else class="my-resume-list" v-model="listLoading" :finished="finished" finished-text="没有更多了" @load="loadData">
            <div class="item" v-for="(item,index) in list" :key="index" @click="resumeClick(item.personID)">
              <div class="show">
                <div class="person">
                  <img src="@/assets/img/company/no-avatar-boy.png" alt="" v-if="item.headImgUrl=='' && item.sex=='男'" />
									<img src="@/assets/img/company/no-avatar-girl.png" alt="" v-else-if="item.headImgUrl=='' && item.sex=='女'" />
                  <img :src="item.headImgUrl" alt="" v-else />
                  <p>
                    <b>{{item.personName}}</b>
                    <span>{{item.resumeViewDateStr}}</span>
                  </p>
                  <p>
                    <span>{{item.sex}}</span>
                    <span>{{item.age}}岁</span>
                    <span>{{item.edu}}</span>
                    <span>{{item.workYears}}</span>
                  </p>
                </div>
              </div>
            </div>
          </van-list>
        </div>
      </div>
    </template>
  </MyVanskeleton>
</template>

<script>
import { NavBar, List } from "vant";
import MyVanskeleton from "@/components/MyVanskeleton.vue";
import Global from '@/Global';
export default {
  name: "LivePlay",
  components: {
    MyVanskeleton,
    [NavBar.name]: NavBar,
    [List.name]: List,
  },
  // 定义属性
  data() {
    return {
      //loading
      skeletonLoading: true,
      listLoading: false,
      finished: false,
      //query data
      query: {
        pageIndex: 0,
        pageSize: 30
      },
      //list
      list: []
    };
  },
  mounted() {
    this.loadData();
  },
  // 方法集合
  methods: {
    loadData() {
      this.query.pageIndex++;
      this.listLoading = true;
      this.$api.get('/CompanyResume/GetGetedResumePageList', this.query).then(res => {
        this.skeletonLoading = false;
        this.listLoading = false;
        if (res.success) {
          //no data
          if (this.query.pageIndex == 1 && res.response.length == 0) {
            //...
          }
          else {
            var resultList = res.response;
            //no more data
            if (this.query.pageIndex != 0 && res.response.length == 0) {
              this.finished = true;
            }
            this.list = [...this.list, ...resultList];
          }
        }
      })
    },
    resumeClick(personID) {
      this.$router.push({ name: 'company-resume-info', query: { personID: personID} });
    },
    onLeftClick() {
      this.$router.back();
    }
  },
};
</script>

<style lang="less">
@import "vant/lib/index.less";
@import "@/assets/css/company.less";
@import "@/assets/css/company.css";
</style>